/**
  ******************************************************************************
  * @file    lcd.c
  * @author  Qilong Huang
  * @version V0.0.1
  * @date    04-03-2020
  * @brief   This file contains functions to initialize the OS.  
  *				 
  *          
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; KION(SZ) R&D Center
  *
  * Licensed under KION, (the "License");
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/

/*===============================================[ private includes  ]================================================*/

#include "lcd.h"

/*===============================================[ private defines   ]================================================*/
/*===============================================[ public  defines   ]================================================*/
U8 OLED_GRAM[8][128] = {0};

/*================================================[ inline functions ]================================================*/

/*================================================[ public functions ]================================================*/

/*================================================[LCD Display Area  ]================================================*/
/*
position(0,0)
	---------------->    x address grows
.-------------------------------------
|                                     |             |
|                                     |             |
|                                     |             |
|                                     |             |
|                                     |             |
|                                     |             |
|                                     |            \|/  y address grows
|                                     |             *
 -------------------------------------.
                                      postion(128, 64)
*/
/**
* @brief	Initializes the 128x64 LCD 
			This function will require modifications for the 128x64 LCD module.
* @param	none
* @note     none
* @retval   none
*/
void LCD_init(void)
{
    GPIO_SetBits(LCDBkport, LCD_Bk);
    GPIO_SetBits(LCDRSTport,LCD_RST);
    LCD_delay(120);
    LCD_WriteCommand1(0xc0);        
    LCD_WriteCommand2(0xc0);        
    LCD_WriteCommand1(0x3f);        
    LCD_WriteCommand2(0x3f); 
    test_pattern();
}

/**
* @brief	Writes Commond to the right half lcd.
* @param	u8	cmd: commond.
* @note     none
* @retval   none
*/
static void LCD_WriteCommand1(u8 cmd)
{
    LCD_delay(6);
    LCDCS1port->BRR = LCD_CS1;
    LCDDIport->BRR = LCD_DI;
    LCDEport->BSRR = LCD_E;
    LCDDataPort->BRR = (~cmd) & 0xff;
    LCDDataPort->BSRR = cmd;
    LCD_delay(6);
    LCDEport->BRR = LCD_E;
    LCD_delay(6);
    LCDCS1port->BSRR = LCD_CS1;
}/*end of LCD_WriteCommand1(u8 cmd)*/

/**
* @brief	Writes Data to the right half lcd.
* @param	u8	cmd: data.
* @note     none
* @retval   none
*/
static void LCD_WriteData1(u8 data)
{
    LCD_delay(6);
    LCDCS1port->BRR = LCD_CS1;
    LCDDIport->BSRR = LCD_DI;
    LCDEport->BSRR = LCD_E;
    LCDDataPort->BRR = (~data) & 0xff;
    LCDDataPort->BSRR = data;
    LCD_delay(6);
    LCDEport->BRR = LCD_E;
    LCD_delay(6);
    LCDCS1port->BSRR = LCD_CS1;
}/*end of LCD_WriteData1(u8 cmd)*/

/**
* @brief	Writes Commond to the left half lcd.
* @param	u8	cmd: commond.
* @note     none
* @retval   none
*/
static void LCD_WriteCommand2(u8 cmd)
{
    LCD_delay(6);
    LCDCS2port->BRR = LCD_CS2;
    LCDDIport->BRR = LCD_DI;
    LCDEport->BSRR = LCD_E;
    LCDDataPort->BRR = (~cmd) & 0xff;
    LCDDataPort->BSRR = cmd;
    LCD_delay(6);
    LCDEport->BRR = LCD_E;
    LCD_delay(6);
    LCDCS2port->BSRR = LCD_CS2;
}/*end of LCD_WriteCommand2(u8 cmd)*/

/**
* @brief	Writes Data to the left half lcd.
* @param	u8	cmd: data.
* @note     none
* @retval   none
*/
static void LCD_WriteData2(u8 data)
{
    LCD_delay(6);
    LCDCS2port->BRR = LCD_CS2;
    LCDDIport->BSRR = LCD_DI;
    LCDEport->BSRR = LCD_E;
    LCDDataPort->BRR = (~data) & 0xff;
    LCDDataPort->BSRR = data;
    LCD_delay(6);
    LCDEport->BRR = LCD_E;
    LCD_delay(6);
    LCDCS2port->BSRR = LCD_CS2;
}/*end of LCD_WriteData2(u8 cmd)*/

/**
* @brief	lcd time squence delay.
* @param	u16 NWT: Nop wait time.
* @note     none
* @retval   none
*/
void LCD_delay(u16 NWT)
{
    u8 i, j;
    for(i = 0; i < 10; i ++)
    {
	    for(j = 0; j < 10; j ++)
		{
            __NOP();
		}
    }
}/*end of nop_wait(u16 NWT)*/

/**
* @brief	Clear LCD display.
* @param	none.
* @note     none
* @retval   none
*/
void LCD_Clear(void)  
{  
	int i,j,x;
	for (j=0; j<8; j++)
	{
		for (i=0; i<128; i++)
		{		
			x=i;
			if(x<64)
			{
				LCD_WriteCommand1(0xB8+j);
				LCD_WriteCommand1(0x40+x);
				LCD_WriteData1(0x00);
			}
			else    
			{
				x=x-64;
				LCD_WriteCommand2(0xB8+j);
				LCD_WriteCommand2(0x40+x);
				LCD_WriteData2(0x00);
			}
		}
	}
}/*end of LCD_Clear()*/

/**
* @brief	test_pattern function.
            Using this function each when display task calls.
* @param	none
* @note     none
* @retval   none
*/
void test_pattern(void)
{
	int i,j,x;
	for (j = 0; j < 8; j ++)
	{
		for (i = 0; i < 128; i ++)
		{		
			x = i;
			if(x < 64)
			{
				x = 63 - x;
				LCD_WriteCommand2(0xB8 + (7 - j));	
				LCD_WriteCommand2(0x40 + x);				
				LCD_WriteData2(OLED_GRAM[j][i]);
				
			}
			else    
			{		
				LCD_WriteCommand1(0xB8 + (7 - j));	
				LCD_WriteCommand1(0x40 + 127 - x);					
				LCD_WriteData1(OLED_GRAM[j][i]);
			}
		} 
	}
}/*end of test_pattern()*/

/**
* @brief	LCD_refresh function.
            Using this function each when display task calls.
* @param	none
* @note     none
* @retval   none
*/
void LCD_refresh(void)
{
	int i,j,x;
	for (j = 0; j < 8; j ++)
	{
		for (i = 0; i < 128; i ++)
		{		
			x = i;
			if(x < 64)
			{
				x = 63 - x;
				LCD_WriteCommand2(0xB8 + (7 - j));	
				LCD_WriteCommand2(0x40 + x);				
				LCD_WriteData2(OLED_GRAM[j][i]);
				
			}
			else    
			{		
				LCD_WriteCommand1(0xB8 + (7 - j));	
				LCD_WriteCommand1(0x40 + 127 - x);					
				LCD_WriteData1(OLED_GRAM[j][i]);
			}
		} 
	}
}/*end of LCD_refresh()*/

/**
* @brief	lcd draw point function.
* @param	x_pos: x postion
            y_pos: y postion
            data: 0x01---make the point show, 0x00---make the point hide
* @note     none
* @retval   none
*/
void LCD_draw_point(U16 x_pos, U16 y_pos, U8 data)
{
	U8 lcd_y_addr1 = y_pos / 8;
	U8 lcd_y_addr2 =  (7 - (y_pos % 8));
	U8 lcd_data_temp = 0x01;
	lcd_data_temp <<= lcd_y_addr2;
	if(data == 0x01)
	{
		OLED_GRAM[lcd_y_addr1][x_pos] |= lcd_data_temp;
	}
	else
	{
		OLED_GRAM[lcd_y_addr1][x_pos] &= ~lcd_data_temp;
	}
}/*end of LCD_draw_point()*/

/**
* @brief	LCD draw line function.
* @param	start_pt_x: start x postion
            start_pt_y: start y postion
            end_pt_x:end x postion
            end_pt_y:end y postion
* @note     none
* @retval   none
*/
void LCD_draw_line(S16 start_pt_x, S16 start_pt_y, S16 end_pt_x, S16 end_pt_y)
{
	S16 n, dx, dy, sgndx, sgndy, dxabs, dyabs, x, y, drawx, drawy;
	dx = end_pt_x - start_pt_x;
	dy = end_pt_y - start_pt_y;
	dxabs = (dx>0)?dx:-dx;
	dyabs = (dy>0)?dy:-dy;
	sgndx = (dx>0)?1:-1;
	sgndy = (dy>0)?1:-1;
	y = dxabs >> 1;
	x = dyabs >> 1;
	drawx = start_pt_x;
	drawy = start_pt_y;

	LCD_draw_point(drawx, drawy, 1);

	if( dxabs >= dyabs )
	{
	  for( n=0; n<dxabs; n++ )
	  {
		 y += dyabs;
		 if( y >= dxabs )
		 {
			y -= dxabs;
			drawy += sgndy;
		 }
		 drawx += sgndx;
		 LCD_draw_point(drawx, drawy, 1);
	  }
	}
	else
	{
	  for( n=0; n<dyabs; n++ )
	  {
		 x += dxabs;
		 if( x >= dyabs )
		 {
			x -= dyabs;
			drawx += sgndx;
		 }
		 drawy += sgndy;
		 LCD_draw_point(drawx, drawy, 1);
	  }
	}  
}/*end of LCD_draw_line()*/
/**
* @brief	LCD draw empty circle function.
* @param	circle_center__pos_x: round center x postion
            circle_center__pos_y: round center y postion
            radious:radious of the round
* @note     none
* @retval   none
*/
void LCD_draw_Empty_circle( S16 circle_center__pos_x, S16 circle_center__pos_y, S16 radious)
{
	S16 x,y,xd,yd,e;

	if ( circle_center__pos_x < 0 ) return;
	if ( circle_center__pos_y < 0 ) return;
	if ( radious <= 0 ) return;

	xd = 1 - (radious << 1);
	yd = 0;
	e = 0;
	x = radious;
	y = 0;

	while ( x >= y )
	{
		LCD_draw_point(circle_center__pos_x - x, circle_center__pos_y + y, 1);
		LCD_draw_point(circle_center__pos_x - x, circle_center__pos_y - y, 1);
		LCD_draw_point(circle_center__pos_x + x, circle_center__pos_y + y, 1);
		LCD_draw_point(circle_center__pos_x + x, circle_center__pos_y - y, 1);	
		LCD_draw_point(circle_center__pos_x - y, circle_center__pos_y + x, 1);
		LCD_draw_point(circle_center__pos_x - y, circle_center__pos_y - x, 1);
		LCD_draw_point(circle_center__pos_x + y, circle_center__pos_y + x, 1);
		LCD_draw_point(circle_center__pos_x + y, circle_center__pos_y - x, 1);	  	   
		y++;
		e += yd;
		yd += 2;
		if ( ((e << 1) + xd) > 0 )
		{
			x--;
			e += xd;
			xd += 2;
		}
	}
}/*end of LCD_draw_Empty_circle()*/

/**
* @brief	LCD draw fill circle function.
* @param	circle_center__pos_x: round center x postion
            circle_center__pos_y: round center y postion
            radious:radious of the round
* @note     none
* @retval   none
*/
void LCD_draw_Fill_circle( S16 circle_center__pos_x, S16 circle_center__pos_y, S16 radious)
{
   S16  x, y, xd;

   if ( circle_center__pos_x < 0 ) return;
   if ( circle_center__pos_y < 0 ) return;
   if ( radious <= 0 ) return;

   xd = 3 - (radious << 1);
   x = 0;
   y = radious;

   while ( x <= y )
   {
     if( y > 0 )
     {
        LCD_draw_line( circle_center__pos_x - x, circle_center__pos_y - y,circle_center__pos_x - x, circle_center__pos_y + y );
        LCD_draw_line( circle_center__pos_x + x, circle_center__pos_y - y,circle_center__pos_x + x, circle_center__pos_y + y );
     }
     if( x > 0 )
     {
        LCD_draw_line( circle_center__pos_x - y, circle_center__pos_y - x,circle_center__pos_x - y, circle_center__pos_y + x );
        LCD_draw_line( circle_center__pos_x + y, circle_center__pos_y - x,circle_center__pos_x + y, circle_center__pos_y + x );
     }
     if ( xd < 0 )
     {
        xd += (x << 2) + 6;
     }
     else
     {
        xd += ((x - y) << 2) + 10;
        y--;
     }
     x++;
   }
   LCD_draw_Empty_circle(circle_center__pos_x, circle_center__pos_y, radious);
}/*end of LCD_draw_Fill_circle()*/

/**
* @brief	LCD draw circle function.
* @param	circle_center__pos_x: round center x postion
            circle_center__pos_y: round center y postion
            radious:radious of the round
            color:filled color, if chose Whie, it will draw a empty round, if choose Black, it will draw a filled round
* @note     none
* @retval   none
*/
void LCD_draw_circle( S16 circle_center__pos_x, S16 circle_center__pos_y, S16 radious, FillColor color)
{
	if(color == White)
	{
		LCD_draw_Empty_circle(circle_center__pos_x, circle_center__pos_y, radious);
	}
	else if(color == Black)
	{
		LCD_draw_Fill_circle(circle_center__pos_x, circle_center__pos_y, radious);
	}
}/*end of LCD_draw_circle()*/

/**
* @brief	LCD draw rectangle function.
* @param	start_pt_x: start x postion
            start_pt_y: start y postion
            x_size: wide of rectangle
            y_size: height of rectangle
            color:filled color, if chose Whie, it will draw a empty round, if choose Black, it will draw a filled round
            is_hide:if choose HIDE_DISABLE, the rectangle will not show, if choose HIDE_DISABLE, the rectangle will show on the LCD
* @note     none
* @retval   none
*/
void LCD_draw_rectangle( S16 start_pt_x, S16 start_pt_y, S16 x_size, S16 y_size, FillColor color, U8 is_hide)
{
	S16 dx, dy, draw_end_point_x, draw_end_point_y;
	if(is_hide == HIDE_DISABLE)
	{	
		if(color == Black)
		{
			for( dx = start_pt_x ; dx < (start_pt_x + x_size); dx ++)
			{
				for( dy = start_pt_y ; dy < (start_pt_y + y_size); dy ++)
				{

						LCD_draw_point(dx, dy, 1);		
				}
			}
		}
		else if(color == White)
		{
			draw_end_point_x = start_pt_x + x_size - 1;
			draw_end_point_y = start_pt_y + y_size - 1;
			LCD_draw_line(start_pt_x, start_pt_y, draw_end_point_x, start_pt_y);
			LCD_draw_line(draw_end_point_x, start_pt_y, draw_end_point_x, draw_end_point_y);
			LCD_draw_line(draw_end_point_x, draw_end_point_y, start_pt_x, draw_end_point_y);
			LCD_draw_line(start_pt_x, draw_end_point_y, start_pt_x, start_pt_y);
		}
	}
	else
	{
		for( dx = start_pt_x ; dx < (start_pt_x + x_size); dx ++)
		{
			for( dy = start_pt_y ; dy < (start_pt_y + y_size); dy ++)
			{
				LCD_draw_point(dx, dy, 0);			
			}
		}		
	}
}/*end of LCD_draw_rectangle()*/

/**
* @brief	LCD draw number function..
* @param	start_row : the charcter's left and top point y-location page from 0 ~ 7
            start_column : the charcter's left and top point x-location pixel from 0 ~ 127
            size : the number's size which is a emnu, SIZE_22, SIZE_12, SIZE_7
            number : the number charcter you want to display from 0 ~ 9
            is_hide : set HIDE_ENABLE to hide the character and it will leave a blank white, set HIDE_DISABLE the show the character, and it will display on the LCD
* @note     none
* @retval   none
*/
void LCD_draw_number( S16 start_row, S16 start_column, font_size size, int number, U8 is_hide)
{
	unsigned char i, j;
	if(size == SIZE_22)			//SIZE_22, It's vertial page from 0~3
	{
		for(i = 0; i < 4; i ++)
		{
			for(j = 0; j < 18; j++)
			{
				if(is_hide == HIDE_ENABLE)
				{
					OLED_GRAM[i + start_row][j + start_column] = 0x00;
				}
				else
				{
					OLED_GRAM[i + start_row][j + start_column] = number_Size22[number][i * 18 + j];
				}			
			}
		}
	}
	else if(size == SIZE_12)	//SIZE_12, It's vertial page from 0~2
	{
		for(i = 0; i < 2; i ++)
		{
			for(j = 0; j < 13; j++)
			{
				if(is_hide == HIDE_ENABLE)
				{
					OLED_GRAM[i + start_row][j + start_column] = 0x00;
				}
				else
				{
					OLED_GRAM[i + start_row][j + start_column] = number_Size12[number][i * 13 + j];
				}			
			}
		}		
	}
	else if(size == SIZE_10)	//SIZE_12, It's vertial page from 0~2
	{
		for(i = 0; i < 2; i ++)
		{
			for(j = 0; j < 8; j++)
			{
				if(is_hide == HIDE_ENABLE)
				{
					OLED_GRAM[i + start_row][j + start_column] = 0x00;
				}
				else
				{
					OLED_GRAM[i + start_row][j + start_column] = number_Size10[number][i * 8 + j];
				}			
			}
		}		
	}
	else if(size == SIZE_7)	//SIZE_7, It's vertial page is 0
	{
		for(j = 0; j < 7; j++)
		{
			if(is_hide == HIDE_ENABLE)
			{
				OLED_GRAM[start_row][j + start_column] = 0x00;
			}
			else
			{
				OLED_GRAM[start_row][j + start_column] = number_Size8[number][j];
			}			
		}		
	}

}/*end of LCD_draw_number()*/

/**
* @brief	LCD draw upper character function..
* @param	start_row : the charcter's left and top point y-location page from 0 ~ 7
            start_column : the charcter's left and top point x-location pixel from 0 ~ 127
            size : the number's size which is a emnu, SIZE_22, SIZE_12, SIZE_7
            number : the number charcter you want to display from 0 ~ 9
            is_hide : set HIDE_ENABLE to hide the character and it will leave a blank white, set HIDE_DISABLE the show the character, and it will display on the LCD
* @note     none
* @retval   none
*/
void LCD_draw_upperchar( S16 start_row, S16 start_column, font_size size, char character, U8 is_hide)
{
	unsigned char i, j;
	if(size == SIZE_7)	//SIZE_7, It's vertial page is 0
	{
		for(j = 0; j < 9; j++)
		{
			if(is_hide == HIDE_ENABLE)
			{
				OLED_GRAM[start_row][j + start_column] = 0x00;
			}
			else
			{
				OLED_GRAM[start_row][j + start_column] = char_upperer_Size7[character - 65][j];
			}			
		}		
	}	
	else if(size == SIZE_10)
	{
		for(i = 0; i < 2; i++)
		{
			for(j = 0; j < 12; j++)
			{
				if(is_hide == HIDE_ENABLE)
				{
					OLED_GRAM[i + start_row][j + start_column] = 0x00;
				}
				else
				{
					OLED_GRAM[i +start_row][j + start_column] = char_upperer_Size10[character - 65][i * 12 + j];
		        }			
		    }		
		}
	}
}/*end of LCD_draw_upperchar()*/

/**
* @brief	LCD draw lower character function..
* @param	start_row : the charcter's left and top point y-location page from 0 ~ 7
            start_column : the charcter's left and top point x-location pixel from 0 ~ 127
            size : the number's size which is a emnu, SIZE_22, SIZE_12, SIZE_7
            number : the number charcter you want to display from 0 ~ 9
            is_hide : set HIDE_ENABLE to hide the character and it will leave a blank white, set HIDE_DISABLE the show the character, and it will display on the LCD
* @note     none
* @retval   none
*/
void LCD_draw_lowerchar( S16 start_row, S16 start_column, font_size size, char character, U8 is_hide)
{
	unsigned char i, j;
	if(size == SIZE_7)	//SIZE_7, It's vertial page is 0
	{
		for(j = 0; j < 8; j++)
		{
			if(is_hide == HIDE_ENABLE)
			{
				OLED_GRAM[start_row][j + start_column] = 0x00;
			}
			else
			{
				OLED_GRAM[start_row][j + start_column] = char_lowerer_Size7[character - 97][j];
			}			
		}		
	}	
    else if(size == SIZE_10)
	{
		for(i = 0; i < 2; i++)
		{
			for(j = 0; j < 12; j++)
			{
				if(is_hide == HIDE_ENABLE)
				{
					OLED_GRAM[i + start_row][j + start_column] = 0x00;
				}
				else
				{
					OLED_GRAM[i +start_row][j + start_column] = char_lowerer_Size10[character - 97][i * 12 + j];
		        }			
		    }		
		}
	}
}/*end of LCD_draw_lowerchar()*/

/**
* @brief	LCD draw sign function..
* @param	start_row : the charcter's left and top point y-location page from 0 ~ 7
            start_column : the charcter's left and top point x-location pixel from 0 ~ 127
            size : the number's size which is a emnu, SIZE_22, SIZE_12, SIZE_7
            sign: the sign you want to show
* @note     none
* @retval   none
*/
void LCD_draw_sign( S16 start_row, S16 start_column, font_size size, int sign)
{
	unsigned char i, j;
	if(size == SIZE_22)
	{
		for(i = 0; i < 4; i ++)
		{
			for(j = 0; j < 26; j++)
			{
				OLED_GRAM[i + start_row][j + start_column] = sign_size22[sign][i * 26 + j];
			}
		}
	}
	else if(size == SIZE_12)
	{
		for(i = 0; i < 2; i ++)
		{
			for(j = 0; j < 13; j++)
			{
				OLED_GRAM[i + start_row][j + start_column] = sign_size12[sign][i * 13 + j];
			}
		}
	}
	else if(size == SIZE_10)
	{
		for(i = 0; i < 2; i ++)
		{
			for(j = 0; j < 13; j++)
			{
				OLED_GRAM[i + start_row][j + start_column] = sign_size10[sign][i * 13 + j];
			}
		}
	}
	else if(size == SIZE_7)
	{
		for(j = 0; j < 9; j++)
		{
			OLED_GRAM[start_row][j + start_column] = sign_size7[sign][j];
		}
	}
}/*end of LCD_draw_sign()*/

/**
* @brief	LCD erasea area function..
* @param	start_pt_x: start x postion
            start_pt_y: start y postion
            x_size: wide of rectangle
            y_size: height of rectangle
* @note     none
* @retval   none
*/
void LCD_ersea_area( S16 start_pt_x, S16 start_pt_y, S16 x_size, S16 y_size)
{
	S16 dx, dy;
	for( dx = start_pt_x ; dx < (start_pt_x + x_size); dx ++)
	{
		for( dy = start_pt_y ; dy < (start_pt_y + y_size); dy ++)
		{
			LCD_draw_point(dx, dy, 0);			
		}
	}
}/*end of LCD_ersea_area*/


/**
* @brief	LCD draw scrollbar on the right side of LCD
* @param	is_hide1:  scrollbar1 show or hide
            is_hide2:  scrollbar2 show or hide
            is_hide3:  scrollbar3 show or hide
            is_hide4:  scrollbar4 show or hidee
* @note     none
* @retval   none
*/
void LCD_draw_scrollbar(U8 is_hide1, U8 is_hide2, U8 is_hide3, U8 is_hide4)
{
	U8  Start_x, Start_y;
	Start_x = 121;
	Start_y = 3;
	if(is_hide1 == HIDE_DISABLE)
	{
		LCD_draw_rectangle( Start_x, Start_y, 5, 12, Black, HIDE_DISABLE );
	}
	else
	{
		LCD_ersea_area( Start_x, Start_y, 5, 12 );
	}
	if(is_hide2 == HIDE_DISABLE)
	{
		LCD_draw_rectangle( Start_x, Start_y + 15, 5, 12, Black, HIDE_DISABLE );
	}
	else
	{
		LCD_ersea_area( Start_x, Start_y + 15, 5, 12 );
	}
	if(is_hide3 == HIDE_DISABLE)
	{
		LCD_draw_rectangle( Start_x, Start_y + 30, 5, 12, Black, HIDE_DISABLE );
	}
	else
	{
		LCD_ersea_area( Start_x, Start_y + 30, 5, 12 );
	}
	if(is_hide4 == HIDE_DISABLE)
	{
		LCD_draw_rectangle( Start_x, Start_y + 45, 5, 12, Black, HIDE_DISABLE );
	}
	else
	{
		LCD_ersea_area( Start_x, Start_y + 45, 5, 12 );
	}
}/*end of LCD_draw_scrollbar*/
/**
* @brief	LCD draw scrollbar on the right side of LCD
* @param	is_hide1:  scrollbar1 show or hide
            is_hide2:  scrollbar2 show or hide
            is_hide3:  scrollbar3 show or hide
            is_hide4:  scrollbar4 show or hidee
* @note     none
* @retval   none
*/
void LCD_draw_errorcode( S16 start_row, S16 start_column, U16 err_code, U8 is_hide)
{
	U8 temp_var[3];
	temp_var[2] = err_code / 100;
	temp_var[1] = (err_code - temp_var[2] * 100) / 10;
	temp_var[0] = err_code - temp_var[2] * 100 - temp_var[1] * 10;
	LCD_draw_number(  start_row,  start_column, SIZE_7, temp_var[2], HIDE_DISABLE);
	LCD_draw_number(  start_row,  start_column + 7, SIZE_7, temp_var[1], HIDE_DISABLE);
	LCD_draw_number(  start_row,  start_column + 14, SIZE_7, temp_var[0], HIDE_DISABLE);
}/*end of LCD_draw_scrollbar*/
